{% extends "base.html" %}

{% block title %}OpenID Identities{% endblock %}

{% block script %}

<script type="text/javascript">
(function() {
    if (typeof window.janrain !== 'object') window.janrain = {};
    window.janrain.settings = {};
    
    janrain.settings.tokenUrl = '{{ server_url }}/openid/callback?next={{ next }}';

    function isReady() { janrain.ready = true; };
    if (document.addEventListener) {
      document.addEventListener("DOMContentLoaded", isReady, false);
    } else {
      window.attachEvent('onload', isReady);
    }

    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.id = 'janrainAuthWidget';

    if (document.location.protocol === 'https:') {
      e.src = 'https://rpxnow.com/js/lib/cotefe/engage.js';
    } else {
      e.src = 'http://widget-cdn.rpxnow.com/js/lib/cotefe/engage.js';
    }

    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(e, s);
})();
</script>

{% endblock %}

{% block content %}

    <img class="logo" src="/pics/openid-logo.png" />

    <p><a class="janrainEngage button" href="#">Connect a new OpenID Identity</a></p>
   
   {% if identities %}
   
   <table>
   
   <tr>
            <th>Provider</th>
            <th>OpenID Identifier</th>
            <th>Manage</th>
   </tr>
   
   {% for identity in identities %}
   
        <tr>
            <td>{{ identity.provider }}</td>
            <td>{{ identity.identifier }}</td>
            <td>
                <form method="post">
                    <input type="hidden" name="identity_id" value="{{ identity.key().id() }}" />
                    <input type="submit" name="submit" value="Disconnect" />
                </form>
            </td>
        </tr>
   
   {% endfor %}
   
    </table>
   
   {% else %}
   
   <p>There are currently no connected OpenID identities.</p>
   
   {% endif %}
   


{% endblock %}